(module test-level0 mzscheme
  (require "../src/core.scm" "../src/prims/level0.scm" "../src/prims/level1.scm"
           "test-support.scm"
           (planet "test.ss" ("schematics" "schemeunit.plt" 2)))
  
  (provide level-0-tests)
  
  ;; All the unit tests available online for the level 0 primitives
  (define level-0-tests
    (test-suite "Level 0 Unit Tests"
                (cat-unit-test "add_int" 1 2 add_int 3 eq)
                (cat-unit-test "compose" [1] [inc] compose apply 2 eq)
                (cat-unit-test "cons" nil 1 cons uncons swap pop 1 eq)
                (cat-unit-test "div_int" 42 7 div_int 6 eq)
                (cat-unit-test "dup" 2 dup add_int 4 eq)
                (cat-unit-test "empty" nil empty popd 1 unit empty popd not 1 2 pair empty popd not and and)
                (cat-unit-test "eq" 1 1 eq)
                (cat-unit-test "false" false [false] [true] if)
                (cat-unit-test "if" true [1] [2] if 1 eq)
                (cat-unit-test "lt_int" 3 5 lt_int)
                (cat-unit-test "mod_int" 5 3 mod_int 2 eq)
                (cat-unit-test "mul_int" 5 3 mul_int 15 eq)
                (cat-unit-test "neg_int" 5 neg_int -5 eq)
                (cat-unit-test "nil" nil nil eq)
                (cat-unit-test "pop" 3 5 pop 3 eq)
                (cat-unit-test "quote" true 1 quote 2 quote if 1 eq)
                (cat-unit-test "swap" 1 2 swap pop 2 eq)
                (cat-unit-test "true" true [true] [false] if)
                (cat-unit-test "uncons" nil 2 cons 1 cons uncons pop uncons swap pop 2 eq)
                (cat-unit-test "while" 1 [2 mul_int] [dup 100 lt_int] while 128 eq))))
